<?php


// 1.Redirects
Route::get('first', function()
{
	// passing the URI
	return Redirect::to('second');
});

/**
 * Return a JSON response from the application.
 *
 * @return \Illuminate\Support\Facades\Response
 */
Route::get('second', function()
{
	return 'Second route.';
});

// 2.Custom Responses
Route::get('custom', function()
{
	$response = Response::make('Hello world!', 200);
	$response->headers->set('Content-Type', 'text/x-markdown');
	return $response;
});

// 	// Get the file location an object class was defined in PHP
// 	$class = new ReflectionClass(get_class(new Response));
// 	echo $class->getFilename();

// 	return Response::json(array(
// 			'error' => false,
// 			'msg' => 'store created successfully.'
// 		),
// 		200
// 	);



/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
 
/****************
 * Admin Routes *
 ****************/
Route::group(['prefix' => 'admin', 'before' => 'adminAuth'], function ()
{
// 	Route::group(['before' => 'adminResourcesAuth'], function ()
// 	{
		Route::resource('user', 'AdminUserController');
		Route::resource('post', 'AdminPostController');
		Route::resource('group', 'AdminGroupController');
// 	});
	
	Route::get('/access-denied', function()
	{
		return View::make("admins.access_denied");
	});
});
Route::controller('admin', 'AdminDashboardController');


// /****************
//  * Front Routes *
//  ****************/
Route::controller('/', 'HomeController');
// Route::group(['prefix' => 'user'], function () 
// {		
// 	Route::any("/request", ["uses" => "UserController@request"]);
// 	Route::any("/reset/{token}", ["uses" => "UserController@reset"]);
	
// 	Route::group(['before' => 'auth'], function()
// 	{
// 		Route::get('/profile', ['as' => 'user.profile', 'uses' => 'UserController@profile']);	
// 	});
	
// 	Route::controller('/', 'UserController');
// });



